import styles from "./style.less";
import { useNavigate } from "umi";
interface Props {
  items: Item[];
}
export default function Items(props: Props) {
  const navigate = useNavigate();
  return (
    <div className={styles["items-container"]}>
      {props.items.map((item: Item) => (
        <div className="item" onClick={
          () => {
            navigate(`/detail?id=${item.id}`)
          }
        } key={item.id}>
          <img
            src={item.pic}
            alt=""
            className="img"
          />
          <div className="item-info">
            <h5 className="name">{item.name}</h5>
            <p>￥{item.minPrice}</p>
          </div>
        </div>
      ))}
    </div>
  );
}


